/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       drag_garrison.cpp

	$Header: /game/drag_garrison.cpp $

	$NoKeywords: $

 ************************************************************************/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "drag_garrison.h"

#include "bitmap_layer.h"
#include "bitmap_layer_window.h"
#include "garrison_button.h"
// ----------------------------------------------------------
// object for dragging an entire garrison out of a town
// ----------------------------------------------------------
t_drag_garrison::t_drag_garrison( t_bitmap_layer const* bitmap, 
								  t_garrison_button* source_window )
{
	t_window* window = new t_bitmap_layer_window( bitmap, t_screen_point(0,0), this, false );
	t_screen_rect rect = bitmap->get_rect();

	m_source_window = source_window;
	set_hot_spot( t_screen_point( rect.width() / 2, rect.height() / 2 ) );

	m_accepted = false;
}

// ----------------------------------------------------------
// object for dragging an entire garrison out of a town
// ----------------------------------------------------------
t_drag_garrison::~t_drag_garrison()
{
	if (!m_accepted)
	{
		m_source_window->select( true );
		m_source_window->highlight( false );
	}
}

// ----------------------------------------------------------
// object for dragging an entire garrison out of a town
// ----------------------------------------------------------
void t_drag_garrison::accepted( t_window* window )
{
	m_accepted = true;
}

